<?php
namespace app\api\controller;
use app\model\Config as ConfigModel;
use think\Db;


class Config extends Base
{
    protected $noCheckToken = ['index','read'];

    /**
     * @Author   CCH
     * @DateTime 2020-05-23T12:10:10+0800
     * @return   数据列表
     */
    public function index(){
        $map_params = [
            
        ];
        $map = getSearchParam($map_params);
        $map[] = ['group','=',1];
        
        $model = new ConfigModel();
        $list = $model->where($map)->select();
        return apiResult('2000','获取成功',$list);
    }

    /**
     * 获取详情
     * @Author   cch
     * @DateTime 2020-05-26T17:22:45+0800
     * @return   [type]                   [description]
     */
    public function read($key){
        $model = new ConfigModel();
        $data = $model->where('key',$key)->find();
        if ($data['type'] == 'files') {
            $data['value'] = explode(',',$data['value']);
        }
        return apiResult('2000','获取成功',$data);
    }
    
}
